package com.icoolkj.ms.rbac.config;

import com.icoolkj.ms.common.cache.adapter.CacheTtlAdapter;
import com.icoolkj.ms.common.cache.bo.CacheNameWithTtlBO;
import com.icoolkj.ms.common.cache.constant.RbacCacheNames;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author icoolkj
 * @version 1.0
 * @description
 * @createDate 2025/02/17 11:21
 */
@Component
public class RbacCacheTtlAdapter implements CacheTtlAdapter {
    @Override
    public List<CacheNameWithTtlBO> listCacheNameWithTtl() {
        List<CacheNameWithTtlBO> cacheNameWithTtls = new ArrayList<>();
        cacheNameWithTtls.add(new CacheNameWithTtlBO(RbacCacheNames.PERMISSIONS_KEY, 60 * 30L));
        cacheNameWithTtls.add(new CacheNameWithTtlBO(RbacCacheNames.USER_PERMISSIONS_KEY, 60 * 30L));
        cacheNameWithTtls.add(new CacheNameWithTtlBO(RbacCacheNames.URI_PERMISSION_KEY, 60 * 30L));
        cacheNameWithTtls.add(new CacheNameWithTtlBO(RbacCacheNames.MENU_LIST_KEY, 60 * 30L));
        cacheNameWithTtls.add(new CacheNameWithTtlBO(RbacCacheNames.MENU_ID_LIST_KEY, 60 * 30L));
        return cacheNameWithTtls;
    }
}
